<script type="text/javascript">
    $(function () {
        $('#resourceAddPid').combotree({
            url: '#(ctx)/admin/roleMenu/menuList',
            parentField: 'pid',
            lines: true,
            panelHeight: 'auto'
        });

        $('#menuAddForm').ajaxForm({
            dataType: "json",
            beforeSubmit: function () {
                return $('#menuAddForm').form('validate');
            },
            success: function (response) {
                progressClose();
                if (response.result) {
                    parent.$.modalDialog.openner_treeGrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为resource.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                }
            }
        });

    });
</script>
<div style="padding: 3px;">
    <form id="menuAddForm" method="post" action="#(ctx)/admin/roleMenu/addMenu">
        <table class="grid">
            <tr>
                <div class="form-item">
                    <td>资源名称</td>
                    <td><input name="menuName" type="text" placeholder="请输入资源名称"
                               class="easyui-validatebox easyui-textbox"
                               data-options="required:true"></td>
                    <td>资源类型</td>
                    <td>
                        <select name="type" class="easyui-combobox"
                                data-options="width:140,height:29,editable:false,panelHeight:'auto'">
                            <option value="0">菜单</option>
                            <option value="1">按钮</option>
                        </select>
                    </td>
                </div>
            </tr>
            <tr>
                <div class="form-item">
                    <td>资源路径</td>
                    <td><input name="url" type="text" placeholder="请输入资源路径" class="easyui-validatebox easyui-textbox"
                               data-options=""></td>
                    <td>排序</td>
                    <td><input name="sort" value="0" class="easyui-numberspinner" style="width: 140px; height: 29px;"
                               required="required" data-options="editable:false">
                    </td>
                </div>
            </tr>
            <tr>
                <div class="form-item">
                    <td>权限标志</td>
                    <td><input name="permission" type="text" placeholder="" class="easyui-validatebox easyui-textbox"
                               data-options="required:true"></td>

                    <td>加载方式</td>
                    <td>
                        <select name="opened" class="easyui-combobox"
                                data-options="width:140,height:29,editable:false,panelHeight:'auto'">
                            <option value="0">iframe</option>
                            <option value="1">href</option>
                        </select>
                    </td>
                </div>
            </tr>
            <tr>
                <div class="form-item">
                    <td>上级资源</td>
                    <td colspan="3">
                        <select id="resourceAddPid" name="parentId" style="width: 200px; height: 29px;"></select>
                        <a class="easyui-linkbutton" href="javascript:void(0)"
                           onclick="$('#resourceAddPid').combotree('clear');">清空</a>
                    </td>
                </div>
            </tr>
        </table>
    </form>
</div>